/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.gmao.entities;

import java.io.Serializable;
import java.math.BigInteger;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Amine
 */
@Entity
@Table(name = "inter_cons")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "InterCons.findAll", query = "SELECT i FROM InterCons i"),
    @NamedQuery(name = "InterCons.findByQunantiteUtilise", query = "SELECT i FROM InterCons i WHERE i.qunantiteUtilise = :qunantiteUtilise"),
    @NamedQuery(name = "InterCons.findByIdentConsutilise", query = "SELECT i FROM InterCons i WHERE i.identConsutilise = :identConsutilise")})
public class InterCons implements Serializable {
    private static final long serialVersionUID = 1L;
    @Column(name = "qunantite_utilise")
    private BigInteger qunantiteUtilise;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 10)
    @Column(name = "ident_consutilise")
    private String identConsutilise;
    @JoinColumn(name = "ident_intervention", referencedColumnName = "ident_intervention")
    @ManyToOne
    private Intervention identIntervention;
    @JoinColumn(name = "ident_cons", referencedColumnName = "ident_cons")
    @ManyToOne
    private Consommable identCons;

    public InterCons() {
    }

    public InterCons(String identConsutilise) {
        this.identConsutilise = identConsutilise;
    }

    public BigInteger getQunantiteUtilise() {
        return qunantiteUtilise;
    }

    public void setQunantiteUtilise(BigInteger qunantiteUtilise) {
        this.qunantiteUtilise = qunantiteUtilise;
    }

    public String getIdentConsutilise() {
        return identConsutilise;
    }

    public void setIdentConsutilise(String identConsutilise) {
        this.identConsutilise = identConsutilise;
    }

    public Intervention getIdentIntervention() {
        return identIntervention;
    }

    public void setIdentIntervention(Intervention identIntervention) {
        this.identIntervention = identIntervention;
    }

    public Consommable getIdentCons() {
        return identCons;
    }

    public void setIdentCons(Consommable identCons) {
        this.identCons = identCons;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (identConsutilise != null ? identConsutilise.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof InterCons)) {
            return false;
        }
        InterCons other = (InterCons) object;
        if ((this.identConsutilise == null && other.identConsutilise != null) || (this.identConsutilise != null && !this.identConsutilise.equals(other.identConsutilise))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.gmao.entities.InterCons[ identConsutilise=" + identConsutilise + " ]";
    }
    
}
